import { createApp } from "vue";
import MessageIndex from '../components/MessageIndex.vue'
export type MessageType = "success" | "error" | "default";
const createMessage = (message: string, type: MessageType, timeout = 2000) => {
    const messageInstance = createApp(MessageIndex, { message, type })
    const mountNode = document.createElement('div')
   document.body.appendChild(mountNode)
   messageInstance.mount(mountNode)
   setTimeout(() => {
    messageInstance.unmount()
    document.body.removeChild(mountNode)
   },timeout)
}
export default createMessage
































